/*
 * Voronoi_channels.h
 *
 *  Created on: Jun 8, 2012
 *      Author: marchi
 */

#ifndef VORONOI_CHANNELS_H_
#define VORONOI_CHANNELS_H_
#include "Voronoi_cavities.h"
#include <iterator>


namespace Cavities {
struct isLargerR{
	static double radius;
	isLargerR(){};
	isLargerR(double y){radius=y;}
	bool operator()(const std::pair<const Vertex,CavityData> & y) const {
		return y.second.gMinRadius() > radius;
	}
	virtual ~isLargerR(){};
};
typedef std::map<Vertex,CavityData>  mapVCD;
typedef std::map<Vertex,std::set<Vertex> > mapVsV;

struct pickPlane{
	vector<int> operator()(vector<int> & v1, vector<int> v2){
		sort(v1.begin(),v1.end());
		sort(v2.begin(),v2.end());
		vector<int> v3(v1.size()+v2.size(),0);
		vector<int>::iterator it,itc;
		it=set_intersection(v1.begin(),v1.end(),v2.begin(),v2.end(),v3.begin());
		v3.erase(it,v3.end());
		return v3;
	}
};
class Voronoi_channels: public Voronoi_cavities  {
	virtual void WriteIt(std::ofstream &);
	vector<double> AtRadius;
	vector<Dvect> Atoms;
	vector<mapVCD> mChannels;
	double intersect(Dvect &,Dvect &,vector<int> &);
	bool Percolate(mapVCD::iterator &, mapVCD &, mapVCD &);
public:
	Voronoi_channels():Voronoi_cavities(){};
	Voronoi_channels(int x, const vector<string> & y,bool z): Voronoi_cavities(x,y,z){};
	virtual void getDelaunay(isTypes &);
	virtual void Channels();
	virtual ~Voronoi_channels(){};

};

} /* namespace Cavities */
#endif /* VORONOI_CHANNELS_H_ */
